#include "stdafx.h"
#include "IDataIoTemp.h"
#include "LoadData.h"

using namespace FTLib;

std::shared_ptr<IBitmapData> FTLib::ReadDataAsFloat32(const wchar_t* szwFilename, LoadDataFormat fmt /* = LoadDataFormat::Invalid*/)
{
		CDataLoad dataLoad(szwFilename);
		return dataLoad.ReadAsFloat32();
}

void FTLib::SaveData(const wchar_t* szwFilename, std::shared_ptr<IBitmapData> bm, SaveDataFormat fmt/* = SaveDataFormat::Invalid*/)
{
	CSaveData dataSave(szwFilename, /*SaveDataFormat::CSV*/fmt);
	switch (bm->GetPixelType())
	{
	case PixelType::GrayFloat32:
	case PixelType::ComplexFloat32:
		dataSave.SaveAsFloat32(bm);
		break;
	case PixelType::Gray16:
		dataSave.SaveAsGray16(bm);
		break;
	case PixelType::Gray8:
		dataSave.SaveAsGray8(bm);
		break;
	}
}

std::shared_ptr<IBitmapData> FTLib::CreateRandomFloat32(uint32_t width, uint32_t height, FTLib::PixelType pixelType, float low, float high, uint32_t seed)
{
	return CreateRandomFloat32Image(width, height,pixelType, low, high, seed);
}